package core.controller.cmds;

import core.controller.CommandController;
import core.dal.OperatorFunctionality;
import exceptions.UserNotFoundException;

public class LogoutCMD implements ICmd{

	OperatorFunctionality functionality;
	final String level = "Operator";
	ICmd nextCMD;
	
	CommandController cc;
	
	public LogoutCMD(CommandController commandController, OperatorFunctionality oF){
		this.cc = commandController;
	}
	
	@Override
	public void setNextCmd(ICmd nextCmd) {
		nextCMD = nextCmd;
		
	}

	@Override
	public void execute(String cmd){
		if (cmd.equals("logout")){
			cc.setCurrentLevel("Login");
			cc.setCurrentUser(null);
			cc.getTUI().showOutput("LOGGED OUT SUCCESSFULLY");
		}
		
		if (nextCMD != null) {
			nextCMD.execute(cmd);
		}
	}

	@Override
	public String getInfo() {
		return "logout - Logs the current user out";
		
	}

	@Override
	public String getLevel() {
		return this.level;
		
	}
}
